#pragma once

#ifdef __cplusplus
extern "C" {
#endif

//
// Log API
//

#define LOG_NO				0x0
#define LOG_DEBUG			0x1
#define LOG_INFO			0x2
#define LOG_WARNING			0x4
#define LOG_ERR				0x8
#define LOG_DUMP			0x10
#define LOG_PERF			0x20
#define LOG_SEP				0x40
#define LOG_PROTOCOL		0x80
#define	LOG_SCREEN_SHOW		0x100
#define LOG_REMOTE_CONTROL	0x200
#define LOG_FTP				0x400
#define LOG_APP_MONITOR		0x800
#define LOG_ACCESS_CONTROL	0x1000
#define LOG_TCP_SERVER		0x2000
#define LOG_TCP_CLIENT		0x4000
#define LOG_RAW				0x8000

#ifdef UNICODE
#define CreateLog CreateLogW
#define WriteLog WriteLogW
#else
#define CreateLog CreateLogA
#define WriteLog WriteLogA
#endif

#ifdef USE_LOG
	#define CREATE_LOG(params) CreateLog params
	#define LOG(params) WriteLog params
	#define CLOSE_LOG CloseLog()
#else
	#define CREATE_LOG(params)
	#define LOG(params)
	#define CLOSE_LOG
#endif

#ifdef LOGEXPORT
#define LOGAPI __declspec( dllexport )
#else
#define LOGAPI __declspec( dllimport )
#endif

LOGAPI BOOL CreateLogA(PCSTR pszID, int nLevel);
LOGAPI VOID WriteLogA(PCSTR szFileName, int nLineNo, int nLogLevel, PCSTR szFmt, ...);
LOGAPI VOID WriteVLogA(PCSTR szFileName, int nLineNo, int nLogLevel, PCSTR szFmt, va_list arglist);
LOGAPI BOOL CreateLogW(PCWSTR pszID, int nLevel);
LOGAPI VOID WriteLogW(PCSTR szFileName, int nLineNo, int nLogLevel, PCWSTR szFmt, ...);
LOGAPI VOID WriteVLogW(PCSTR szFileName, int nLineNo, int nLogLevel, PCWSTR szFmt, va_list arglist);
LOGAPI VOID WriteData(BYTE* pData, DWORD dwLen);
LOGAPI VOID CloseLog();

#ifdef __cplusplus
}
#endif